package com.example.othree.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.othree.entity.PollutionHistoryDataJjjSitesSeason;
import com.example.othree.entity.PollutionHistoryDataJjjSitesYear;
import com.example.othree.mapper.PollutionHistoryDataJjjSitesYearMapper;
import com.example.othree.service.PollutionHistoryDataJjjSitesYearService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

@Service
public class PollutionHistoryDataJjjSitesYearServiceImpl extends ServiceImpl<PollutionHistoryDataJjjSitesYearMapper, PollutionHistoryDataJjjSitesYear> implements PollutionHistoryDataJjjSitesYearService {

    @Resource
    PollutionHistoryDataJjjSitesYearMapper pollutionHistoryDataJjjSitesYearMapper;

    @Override
    public List<PollutionHistoryDataJjjSitesYear> pollutionAnalyzeDataByDate(String startTime, String endTime, String[] cities){
        return pollutionHistoryDataJjjSitesYearMapper.pollutionForSite(startTime, endTime, cities);
    }

    @Override
    public List<HashMap<String, String>> pollutionAnalyzeDataByCityForAvg(String startTime, String endTime, String element, String[] cities) {
        return pollutionHistoryDataJjjSitesYearMapper.pollutionForSiteByAvea(startTime, endTime, element, cities);
    }

    @Override
    public PollutionHistoryDataJjjSitesYear pollutionForLevel(String startTime, String endTime, String region) {
        PollutionHistoryDataJjjSitesYear p = pollutionHistoryDataJjjSitesYearMapper.pollutionForLevel(startTime, endTime, new String[]{region});
        return p;
    }

    @Override
    public PollutionHistoryDataJjjSitesYear pollutionForCount(String startTime, String endTime, String region) {
        PollutionHistoryDataJjjSitesYear p = pollutionHistoryDataJjjSitesYearMapper.pollutionForCount(startTime, endTime, new String[]{region});
        return p;
    }


}
